
#ifndef _SC_GUI_H
#define _SC_GUI_H

/*---------------------------------------------------------------
*                        SC_GUI for V1.1
* 一个小内存占用支持LVGL抗锯齿字体，背景透明度的小型开源GUI
* 感谢网友开源工具Lvgl Font Tool V0.4 生成 阿里(qq:617622104)
* 作者:黎R(WX:13018616872)
* 社区:(QQ群:799501887)
*---------------------------------------------------------------
*/
#include "sc_lcd.h"

typedef struct
{
    u8 *map;
    u16 w;
    u16 h;
}SC_img_t;

typedef struct
{
    s16  xs;
    s16  ys;
    s16  xe;
    s16  ye;
    u16  type;
} SC_OBJ;

typedef struct
{
    u16        lcd_w;
    u16        lcd_h;
    u16        fc;      //¶¥²ã
    u16        bkc;     //ÖÐ¼ä²ã
    u16        bc;      //µ×²ã

    u16        state;
    u16        alpha;

    void*      font;                            //GUI×ÖÌå
    SC_img_t   *gbkg;                           //GUI±³¾°Í¼Æ¬
    SC_OBJ     *text;                           //ÎÄ±¾¿Ø¼þ

    void      (*bsp_pset)(int,int,u16);
    void      (*gui_pset)(int,int,u16);
    void      (*Refresh)(int xs,int ys,int xe,int ye);

} SC_GUI;

extern SC_GUI *gui;

void SC_GUI_Init(SC_GUI* g, void (*bsp_pset)(int,int,u16), u16 fc, u16 bc,void* font);

void  SC_Show_Image(int xs,int ys,SC_img_t *bmp);

void  SC_Read_Image(int xs,int ys,u16 w,u16 h,SC_img_t *img,u16 *buf);

void  SC_Show_str(int x,int y,u16 fc,const char* txt, u16 code, lv_font_t* font);

void  SC_Show_float(int x,int y,u16 fc,int num,u16 div,lv_font_t* font);

void  SC_OBJ_cfg(SC_OBJ* obj,int xs,int ys,int xe,int ye,u16 state);

void  SC_OBJ_text_show(SC_OBJ* text,int offsx,int offsy,char *str,u16 fc,u16 bc,u16 alpha);

void LCD_Show_oscillogram(int xs,int ys,int xe,int ye,u16 fc,u16 bc,s16 vol);

void LCD_Show_oscillogram1(int xs,int ys,int xe,int ye,u16 fc,u16 bc,s16 vol);


#define  SC_STATE_IMAGE        0x01   //图片
#define  SC_STATE_STR_MID      0x02   //居中齐
#define  SC_STATE_STR_RIG      0x04   //右对齐


#define  SC_STATE_TEXT         0x10   //TEXT
#define  SC_STATE_CHART        0x20   //示波器


#endif
